const state = {
  isLogin: false, // 登录状态
  isMessage: false // 是否有消息
}

const getters = {
  isLogin: state => state.isLogin,
  isMessage: state => state.isMessage
}

const actions = {
  fetchIsLogin: ({ commit, state }, text) => {
    commit('updateLoginState', text)
  },
  fetchIsMessage: ({ commit, state }, text) => {
    commit('updateMessageState', text)
  }
}

const mutations = {
  updateLoginState: (state, payload) => {
    state.isLogin = payload
  },
  updateMessageState: (state, payload) => {
    state.isMessage = payload
  }
}

export default {
  state,
  getters,
  actions,
  mutations
}
